#

| Chapter 2 UNIX Commands |

## tail

    tail [options] [file]

Print the last ten lines of the named `file`. Use only one of -f or -r.

### Options

-f

  Don't quit at the end of file; "follow" file as it grows. End with a BREAK (CTRL-C).

-r

  Copy lines in reverse order.

-`n`[`k`]

  Begin printing at `n`th item from end of file. `k` specifies the item to count: l (lines, the default), b (blocks), or c (characters).

-`k`

  Same as previous, but use the default count of 10.

+`n`[`k`]

  Like -`n`, but start at `n`th item from beginning of file.

+`k`

  Like -`k`, but count from beginning of file.

### Examples

Show the last 20 lines containing instances of .Ah:

>     grep '.Ah' file | tail -20

Continually track the latest uucp activity:

>     tail -f /usr/spool/uucp/LOGFILE

Show the last ten characters of variable name:

>     echo "$name" | tail -c

Reverse all lines in list:

>      tail -r list

Reference: tabs |  | Reference: talk